package com.javapda.c328r.command.impl;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.javapda.util.ByteUtil;


/**
 * 
 * 
 */
public class RequestPackageDataComediaCommand extends AckComediaCommand {
	private transient String toString;

	public String toString() {
		if (toString == null) {
			toString = new ToStringBuilder(this)
							.append("Cmd ID", getCmdId())
							.append("Ack Counter",getAckCounter())
							.append("Pkg ID Byte 0", getPackageIdByte0())
							.append("Pkg ID Byte 1", getPackageIdByte1())
							.toString();
		}
		return toString;
	}
	
	public void setPackageId(int packageId) {
//		System.out.println("input package id = " +packageId);
		int[] nums = ByteUtil.getIntBytesFromInt(packageId);
//		System.out.println("0-"+nums[0]);
//		System.out.println("1-"+nums[1]);
		
		setPackageIdByte0(nums[0]);
		setPackageIdByte1(nums[1]);
	}
	public int getPackageId() {
		int[] nums = { getPackageIdByte0(), getPackageIdByte1() };
		int packageId = ByteUtil.intArrayToInt(nums);
		return packageId;
	}
	
	public void setCmdId(int commandId) {
		setParameter1(commandId);
	}
	public int getCmdId() { return getParameter1(); }
	private void setPackageIdByte0(int pidByte) {
		setParameter3(pidByte);
	}
	public int getPackageIdByte0() {
		return getParameter3();
	}
	private void setPackageIdByte1(int pidByte) {
		setParameter4(pidByte);
	}
	public int getPackageIdByte1() {
		return getParameter4();
	}
	private void setAckCounter(int ackCounter) {
		setParameter2(ackCounter);
	}
	public int getAckCounter() {
		return getParameter2();
	}

}
